package com.china08.yxyapi.api.manage.edu.platform.schooltuijian;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.security.profile.YxyProfile;

@CrossOrigin
@RestController
public class EduSchoolInfoController extends YxyApiBaseController {

    @RequestMapping(value = "/api_yw/manage/edu/platform/schooltuijian/eduinfo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel precess(HttpServletRequest request, HttpServletResponse response) {
        YxyProfile yxyProfile = getProfile(request, response);
        RespModel respModel = new RespModel();
        if (yxyProfile.getSchoolIsBureau()) {
            respModel.bureauLevel = yxyProfile.getSchoolBureauLevel();
            respModel.areaIdProvince = yxyProfile.getSchoolAreaIdProvince();
            respModel.areaIdCity = yxyProfile.getSchoolAreaIdCity();
            respModel.areaIdDistrict = yxyProfile.getSchoolAreaIdDistrict();
        }
        return respModel;
    }

    public static class RespModel extends YxyApiRespModel {
        public Integer bureauLevel;
        public String areaIdProvince;
        public String areaIdCity;
        public String areaIdDistrict;
    }
}
